package tmall.framework.eobj;

import lombok.Data;

import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicBoolean;

@Data
public class SegmentBufferEobj {
    private SegmentEobj[] buffer = new SegmentEobj[2];
    private volatile  boolean isInit;
    private volatile boolean isSecondReady = false;
    private AtomicBoolean isInitingSecondBuffer = new AtomicBoolean(false);
    private SegmentEobj current;
    public void setCurrent(SegmentEobj segmentEobj){
          buffer[0] = segmentEobj;
    }
    public SegmentEobj getCurrent(){
        return buffer[0];
    }

    public void setSecond(SegmentEobj segment){
          buffer[1] = segment;
    }
    public synchronized void swapBuffer(){
        buffer[0] = buffer[1];
    }


}
